//
//  MYTextView.m
//  奇闻
//
//  Created by 似水灵修 on 14-11-30.
//  Copyright (c) 2014年 MingYueGuCheng. All rights reserved.
//

#import "MYTextView.h"

@interface MYTextView ()
@property (nonatomic, weak) UILabel *placeHolderLabel;
@end
@implementation MYTextView
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.font = [UIFont systemFontOfSize:14];
    }
    return self;
}
- (UILabel *)placeHolderLabel
{
    if (nil == _placeHolderLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.font = self.font;
        [self addSubview:label];
        self.placeHolderLabel = label;
    }
    return _placeHolderLabel;
}
- (void)setPlaceholder:(NSString *)placeholder
{
    _placeholder = [placeholder copy];
    self.placeHolderLabel.text = placeholder;
    [self.placeHolderLabel sizeToFit];
    self.placeHolderLabel.x = 5;
    self.placeHolderLabel.y = 8;
}
- (void)setHidePlaceHolder:(BOOL)hidePlaceHolder
{
    _hidePlaceHolder = hidePlaceHolder;
    self.placeHolderLabel.hidden = hidePlaceHolder;
}
@end
